//
//  OAuthController.h
//  JustPhotoIt
//
//  Created by mac on 11-4-18.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import <UIKit/UIKit.h>


@class OAuthEngine, OAuthController;

@protocol OAuthControllerDelegate <NSObject>
@optional
- (void) OAuthController: (OAuthController *) controller authenticatedWithUsername: (NSString *) username;
- (void) OAuthControllerFailed: (OAuthController *) controller;
- (void) OAuthControllerCanceled: (OAuthController *) controller;
@end

@interface OAuthController : UIViewController <UIWebViewDelegate>{

	OAuthEngine						*_engine;
	UIWebView									*_webView;
	UINavigationBar								*_navBar;
	
	id <OAuthControllerDelegate>			_delegate;
	UIView										*_blockerView;
	
	UIInterfaceOrientation                      _orientation;
	BOOL										_loading, _firstLoad;
	UIToolbar									*_pinCopyPromptBar;
	UIInterfaceOrientation orientation;
}
@property (nonatomic, readwrite) UIInterfaceOrientation orientation;
@property (nonatomic, readwrite, retain) OAuthEngine *engine;
@property (nonatomic, readwrite, assign) id <OAuthControllerDelegate> delegate;
@property (nonatomic, readonly) UINavigationBar *navigationBar;
//@property (nonatomic, readonly) UIToolbar *pinCopyPromptBar;

+ (OAuthController *) controllerToEnterCredentialsWithEngine: (OAuthEngine *) engine 
													delegate: (id <OAuthControllerDelegate>) delegate;
+ (BOOL) credentialEntryRequiredWithEngine: (OAuthEngine *) engine;
+ (OAuthController *) controllerToEnterCredentialsWithEngine: (OAuthEngine *) engine delegate: (id <OAuthControllerDelegate>) delegate forOrientation: (UIInterfaceOrientation)theOrientation;

- (id) initWithEngine: (OAuthEngine *) engine andOrientation:(UIInterfaceOrientation)theOrientation;
//- (void) performInjection;
- (NSString *) locateAuthPinInWebView: (UIWebView *) webView;

//- (void) showPinCopyPrompt;
- (void) gotPin: (NSString *) pin;
- (void) denied;
- (void) cancel: (id) sender;
@end
